from rest_framework import serializers
from rest_framework_mongoengine import serializers as mongoserializers

from foundation.models import FundChina, FundEU, FundUSA


class ListFundChinaSerializer(mongoserializers.DynamicDocumentSerializer):
    class Meta:
        model = FundChina
        fields = ('id', 'pic', 'org', 'amount', 'projectNum', 'type', 'department', 'approvalDate', 'project', 'exeTime')

class FundChinaSerializer(mongoserializers.DynamicDocumentSerializer):
    id = serializers.CharField()

    class Meta:
        model = FundChina
        fields = '__all__'

class ListFundEUSerializer(mongoserializers.DynamicDocumentSerializer):
    class Meta:
        model = FundEU
        fields = ('id', 'title', 'startDate', 'endDate', 'coordinator')

class FundEUSerializer(mongoserializers.DynamicDocumentSerializer):
    id = serializers.CharField()

    class Meta:
        model = FundEU
        fields = '__all__'

class ListFundUSASerializer(mongoserializers.DynamicDocumentSerializer):
    class Meta:
        model = FundUSA
        fields = ('id', 'title', 'startDate', 'endDate', 'unit', 'coordinator')

class FundUSASerializer(mongoserializers.DynamicDocumentSerializer):
    id = serializers.CharField()

    class Meta:
        model = FundUSA
        fields = '__all__'
